package com.yusheng.tr.common.core.openfeign.factory;



import com.yusheng.exceptions.BizException;
import com.yusheng.exceptions.ExceptionEnum;
import com.yusheng.tr.common.core.entity.system.SysUser;
import com.yusheng.tr.common.core.openfeign.base.ISysUserFeignService;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @ClassName jiang_jun_qin
 * @date 2023/4/12 21:31
 * @Version 1.0
 */
@Component
public class SysUserFeignServiceFallback implements FallbackFactory<ISysUserFeignService> {

    @Override
    public ISysUserFeignService create(Throwable cause) {
        return new ISysUserFeignService() {

            @Override
            public SysUser selectUserByUserName(String username) {
                throw new BizException(ExceptionEnum.FEIGN_ERROR);
            }

            @Override
            public void updateUserProfile(SysUser sysUser) {
                throw new BizException(ExceptionEnum.FEIGN_ERROR);
            }
        };
    }
}
